package com.smedi.ismedi.inmail.api.feign;

import com.smedi.ismedi.authority.starter.request.ValidGroup;
import com.smedi.ismedi.inmail.api.dto.request.QueryListTaskRecordRequest;
import com.smedi.ismedi.inmail.api.dto.request.QueryPageTaskRecordRequest;
import com.smedi.ismedi.inmail.api.dto.request.TaskRecordDeleteRequest;
import com.smedi.ismedi.inmail.api.dto.request.TaskRecordRequest;
import com.smedi.ismedi.inmail.api.dto.response.TaskRecordCountResponse;
import com.smedi.ismedi.inmail.api.dto.response.TaskRecordResponse;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

/**
 * @author u
 */
@Validated
@RestController
@FeignClient("ismedi-inmail")
@Api(tags = "任务接口")
@RequestMapping(value = "/api/v1/Task")
public interface RemoteTaskFeignApi {
    @ApiOperation(httpMethod = "POST", value = "任务处理")
    @PostMapping("/dealTask")
    ResponseData<Boolean> postUpdateTask(@RequestBody TaskRecordRequest taskRecordRequest);

    @ApiOperation(httpMethod = "POST", value = "创建任务")
    @PostMapping("/addTask")
    ResponseData<TaskRecordResponse> postAddTask(@Validated(ValidGroup.Add.class) @RequestBody TaskRecordRequest taskRecordRequest);

    @ApiOperation(httpMethod = "DELETE", value = "删除任务")
    @DeleteMapping("/deleteTask")
    ResponseData<Boolean> postDeleteTask(@RequestParam("taskIds") List<Long> ids);

    @ApiOperation(httpMethod = "DELETE", value = "根据来源列表删除任务")
    @DeleteMapping("/deleteTask/sources")
    ResponseData<Boolean> postDeleteTaskBySources(@RequestBody List<TaskRecordDeleteRequest> taskRecordDeleteRequests);

    @ApiOperation(httpMethod = "GET", value = "阅读任务")
    @GetMapping("/readTask")
    ResponseData<List<TaskRecordResponse>> postReadTask(@RequestParam("taskIds") List<Long> ids);

    @ApiOperation(httpMethod = "POST", value = "阅读任务(安全日志）")
    @PostMapping("/readTaskDaily")
    ResponseData<TaskRecordResponse> postReadTaskDaily(@RequestBody TaskRecordRequest taskRecordRequest);

    @ApiOperation(httpMethod = "GET", value = "任务统计")
    @GetMapping("/getTaskRecordCount")
    ResponseData<TaskRecordCountResponse> getTaskRecordCount(@RequestParam("personId") Long id);

    @ApiOperation(httpMethod = "GET", value = "任务列表")
    @GetMapping("/queryListTaskRecord")
    ResponseData<List<TaskRecordResponse>> getQueryListTaskRecord(@Validated @SpringQueryMap QueryListTaskRecordRequest queryListTaskRecordRequest);

    @ApiOperation(httpMethod = "GET", value = "任务列表分页")
    @GetMapping("/queryPageTaskRecord")
    ResponseData<PaginationData<TaskRecordResponse>> getQueryPageTaskRecord(@Validated @SpringQueryMap QueryPageTaskRecordRequest queryPageTaskRecordRequest);

    @ApiOperation(httpMethod = "POST", value = "定时任务")
    @PostMapping("/postScheduleTask")
    ResponseData<Boolean> postScheduleTask();

    @ApiOperation(httpMethod = "GET", value = "定时更新待办任务")
    @GetMapping("/updateTaskStatus")
    ResponseData<Integer> updateTaskStatus();

    @ApiOperation(httpMethod = "POST", value = "定时更新代办任务状态")
    @PostMapping(value = "/updateTask/regular")
    ResponseData<Boolean> postUpdateTaskRegularly();

    @ApiOperation(httpMethod = "POST", value = "每周消息提醒")
    @PostMapping(value = "/safetyCheck/week")
    ResponseData<Boolean> postSafetyCheckWeekly();

    @ApiOperation(httpMethod = "POST", value = "每月消息提醒")
    @PostMapping(value = "/safetyCheck/month")
    ResponseData<Boolean> postSafetyCheckMonthly();

    @ApiOperation(httpMethod = "POST", value = "修复代办任务的历史数据")
    @PostMapping(value = "/deleteHistoryTask")
    ResponseData<Boolean> postDeleteHistoryTask();

    @ApiOperation(httpMethod = "POST", value = "任务撤销")
    @PostMapping("/cancelTask")
    ResponseData<Boolean> postCancelTask(@RequestBody TaskRecordRequest taskRecordRequest);
}
